package lacus.wd_cinema.entity;

import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 放映厅实体类
 * @author lacus
 * @version 0.4
 * @since 0.2
 */
@Data
@Entity
@NoArgsConstructor
@AllArgsConstructor
@Table(name = "hall_tbl")
public class Hall {
    @Id
    @Column(name = "id")
    private String id;

    @Column(name = "name", nullable = false, unique = true)
    private String name;

    @Column(name = "rows", nullable = false)
    private int rows;

    @Column(name = "cols", nullable = false)
    private int cols;

    /** 计算放映厅的总座位数 */
    public int countOfSeats() {
        return rows * cols;
    }
}
